package 面试.解析url;

public class Test {
    



    static Object1 jixi(String url){

        String[] split1=url.split("\\?");;
        String context=split1[1];

        String[] split2=context.split("\\&");
        Object1 object1=new Object1();
        object1.name=new String[split2.length];
        object1.value=new String[split2.length];
        for (int i=0;i<split2.length;i++) {

            object1.name[i]=split2[i].split("=")[0];
            object1.value[i]=split2[i].split("=")[1];

        }
        return object1;
    }

    public static void main(String[] args) {
           Object1 object1=jixi("?uname=dingding&upwd=123455&favs=swimming&favs=running&favs=basketball");
           int n=object1.name.length;
           for(int i=0;i<n;i++){
               System.out.println(object1.name[i]+"="+object1.value[i]);
           }
    }
}
